import Vue from "vue";
import Vuex from "vuex";
Vue.use(Vuex);
import axios from "axios";

var store = new Vuex.Store({
    state:{
        list:[],
        ten:[],
    },
    mutations:{
        setList:function(state,value){
            state.list = value;
        },
        setTen:function(state,value){
            state.ten = value;
        }
    },
    actions:{
        requestList:function(state,data){
            axios.get("/api/slideshow")
            .then(res=>{
                state.commit("setList",res.data.list)
            })
        },
        requestTen:function(state,data){
            axios.get("/api/slideshow")
            .then(res=>{
                state.commit("setTen",res.data.ten)
            })
        }
    }
})



export default store;